import 'package:boss/models/sort_commodity_cell.dart';
import 'package:boss/textStyle/text_style.dart';
import 'package:boss/ui/widget/label_button.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';

class CommodityRow extends StatelessWidget {
  final SortCommodityCell data;
  final VoidCallback onTap;

  const CommodityRow(this.data, {this.onTap});

  @override
  Widget build(BuildContext context) {
    return DefaultTextStyle(
      style: TextStyleConstant().normal_1_28,
      child: Container(
        height: 80.w,
        alignment: Alignment.center,
        child: Row(
          children: <Widget>[
            Expanded(
              child: Center(child: Text(data.name)),
              flex: 2,
            ),
            Expanded(
              child: Center(child: Text('${data.cellNum}')),
              flex: 2,
            ),
            Expanded(
              child: Center(child: Text(AmountUtil.price2String(data.totalFee))),
              flex: 2,
            ),
            Expanded(
              child: Center(
                child: LabelButton(
                  title: '明细',
                  onTap: onTap,
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
